package cate.common.table.res.racebadge.row;

import cate.common.table.EExcelNoteField;
import cate.common.table.EExcelRowClass;
import cate.common.table.ERow;
import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Map;

@EExcelRowClass(IDTitle = "ID")
public class RaceBadgeGradeRow extends ERow {
    @EExcelNoteField(fieldName = "阵营")
    public byte camp;
    @EExcelNoteField(fieldName = "阶数")
    public int grade;
    @EExcelNoteField(fieldName = "升阶等级要求")
    public int levelLimit;
    @EExcelNoteField(fieldName = "升阶消耗道具")
    public String consumeItemStr;
    @EExcelNoteField(fieldName = "消耗卡牌")
    public String consumeHeroStr;
    @EExcelNoteField(fieldName = "属性提升")
    private String percentAttrStr;
    @EExcelNoteField(fieldName = "固定属性")
    public String attrStr;

    public Map<Integer, Double> percent;

    @Override
    public void decode() {
        percent = new HashMap<>();
        if (StringUtils.isNotBlank(percentAttrStr)) {
            for (String attrStr : percentAttrStr.split("#")) {
                String arr[] = attrStr.split(":");
                percent.put(Integer.parseInt(arr[0]), Integer.parseInt(arr[1]) / 10000d);
            }
        }
    }
}
